home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / ADSP.p next >
Encoding:
Text File  |  1991-04-03  |  9.6 KB  |  191 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {}
  4. {Created: Sunday, January 6, 1991 at 10:17 PM}
  5. {    ADSP.p}
  6. {    Pascal Interface to the Macintosh Libraries}
  7. {}
  8. {        Copyright Apple Computer, Inc.    1986-1990}
  9. {        All rights reserved}
  10. {}
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18. unit ADSP;
  19. interface
  20.     uses
  21.         Types, OSUtils, AppleTalk;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.     const
  36.  
  37. { driver control ioResults }
  38.         errRefNum = -1280;                                          { bad connection refNum }
  39.         errAborted = -1279;                                         { control call was aborted }
  40.         errState = -1278;                                           { bad connection state for this operation }
  41.         errOpening = -1277;                                         { open connection request failed }
  42.         errAttention = -1276;                                       { attention message too long }
  43.         errFwdReset = -1275;                                        { read terminated by forward reset }
  44.         errDSPQueueSize = -1274;                                    { DSP Read/Write Queue Too small }
  45.         errOpenDenied = -1273;                                      { open connection request was denied }
  46.  
  47. {driver control csCodes}
  48.         dspInit = 255;                                              { create a new connection end }
  49.         dspRemove = 254;                                            { remove a connection end }
  50.         dspOpen = 253;                                              { open a connection }
  51.         dspClose = 252;                                             { close a connection }
  52.         dspCLInit = 251;                                            { create a connection listener }
  53.         dspCLRemove = 250;                                          { remove a connection listener }
  54.         dspCLListen = 249;                                          { post a listener request }
  55.         dspCLDeny = 248;                                            { deny an open connection request }
  56.         dspStatus = 247;                                            { get status of connection end }
  57.         dspRead = 246;                                              { read data from the connection }
  58.         dspWrite = 245;                                             { write data on the connection }
  59.         dspAttention = 244;                                         { send an attention message }
  60.         dspOptions = 243;                                           { set connection end options }
  61.         dspReset = 242;                                             { forward reset the connection }
  62.         dspNewCID = 241;                                            { generate a cid for a connection end }
  63.  
  64. { connection opening modes }
  65.         ocRequest = 1;                                              { request a connection with remote }
  66.         ocPassive = 2;                                              { wait for a connection request from remote }
  67.         ocAccept = 3;                                               { accept request as delivered by listener }
  68.         ocEstablish = 4;                                            { consider connection to be open }
  69.  
  70. { connection end states }
  71.         sListening = 1;                                             { for connection listeners }
  72.         sPassive = 2;                                               { waiting for a connection request from remote }
  73.         sOpening = 3;                                               { requesting a connection with remote }
  74.         sOpen = 4;                                                  { connection is open }
  75.         sClosing = 5;                                               { connection is being torn down }
  76.         sClosed = 6;                                                { connection end state is closed }
  77.  
  78. { client event flags }
  79.         eClosed = $80;                                              { received connection closed advice }
  80.         eTearDown = $40;                                            { connection closed due to broken connection }
  81.         eAttention = $20;                                           { received attention message }
  82.         eFwdReset = $10;                                            { received forward reset advice }
  83.  
  84. { miscellaneous constants }
  85.         attnBufSize = 570;                                          { size of client attention buffer }
  86.         minDSPQueueSize = 100;                                      { Minimum size of receive or send Queue }
  87.  
  88.     type
  89. { connection control block }
  90.         TPCCB = ^TRCCB;
  91.         TRCCB = packed record
  92.                 ccbLink: TPCCB;                                         { link to next ccb }
  93.                 refNum: INTEGER;                                        { user reference number }
  94.                 state: INTEGER;                                         { state of the connection end }
  95.                 userFlags: Byte;                                        { flags for unsolicited connection events }
  96.                 localSocket: Byte;                                      { socket number of this connection end }
  97.                 remoteAddress: AddrBlock;                               { internet address of remote end }
  98.                 attnCode: INTEGER;                                      { attention code received }
  99.                 attnSize: INTEGER;                                      { size of received attention data }
  100.                 attnPtr: Ptr;                                           { ptr to received attention data }
  101.                 reserved: packed array[1..220] of Byte;                { adsp internal use }
  102.             end;
  103.  
  104. {driver control call parameter block}
  105.         DSPPBPtr = ^DSPParamBlock;
  106.         DSPParamBlock = packed record
  107.                 qLink: QElemPtr;
  108.                 qType: INTEGER;
  109.                 ioTrap: INTEGER;
  110.                 ioCmdAddr: Ptr;
  111.                 ioCompletion: ProcPtr;
  112.                 ioResult: OSErr;
  113.                 ioNamePtr: StringPtr;
  114.                 ioVRefNum: INTEGER;
  115.                 ioCRefNum: INTEGER;                                     { adsp driver refNum }
  116.                 csCode: INTEGER;                                        { adsp driver control code }
  117.                 qStatus: LONGINT;                                       { adsp internal use }
  118.                 ccbRefNum: INTEGER;                                     { refnum of ccb }
  119.                 case INTEGER of
  120.                     dspInit, dspCLInit: (
  121.                             ccbPtr: TPCCB;                                     {pointer to connection control block}
  122.                             userRoutine: ProcPtr;                              {client routine to call on event}
  123.                             sendQSize: INTEGER;                                {size of send queue (0..64K bytes)}
  124.                             sendQueue: Ptr;                                   {client passed send queue buffer}
  125.                             recvQSize: INTEGER;                                {size of receive queue (0..64K bytes)}
  126.                             recvQueue: Ptr;                                    {client passed receive queue buffer}
  127.                             attnPtr: Ptr;                                      {client passed receive attention buffer}
  128.                             localSocket: Byte;                                 {local socket number}
  129.                             filler1: Byte;                                     {filler for proper byte alignment}
  130.                     );
  131.                     dspOpen, dspCLListen, dspCLDeny: (
  132.                             localCID: INTEGER;                             {local connection id}
  133.                             remoteCID: INTEGER;                            {remote connection id}
  134.                             remoteAddress: AddrBlock;                      {address of remote end}
  135.                             filterAddress: AddrBlock;                      {address filter}
  136.                             sendSeq: LONGINT;                              {local send sequence number}
  137.                             sendWindow: INTEGER;                           {send window size}
  138.                             recvSeq: LONGINT;                              {receive sequence number}
  139.                             attnSendSeq: LONGINT;                          {attention send sequence number}
  140.                             attnRecvSeq: LONGINT;                          {attention receive sequence number}
  141.                             ocMode: Byte;                                  {open connection mode}
  142.                             ocInterval: Byte;                              {open connection request retry interval}
  143.                             ocMaximum: Byte;                               {open connection request retry maximum}
  144.                             filler2: Byte;                                 {filler for proper byte alignment}
  145.                     );
  146.                     dspClose, dspRemove: (
  147.                             abort: Byte;                               {abort connection immediately if non-zero}
  148.                             filler3: Byte;                             {filler for proper byte alignment}
  149.                     );
  150.                     dspStatus: (
  151.                             statusCCB: TPCCB;                      {pointer to ccb}
  152.                             sendQPending: INTEGER;                 {pending bytes in send queue}
  153.                             sendQFree: INTEGER;                    {available buffer space in send queue}
  154.                             recvQPending: INTEGER;                 {pending bytes in receive queue}
  155.                             recvQFree: INTEGER;                    {available buffer space in receive queue}
  156.                     );
  157.                     dspRead, dspWrite: (
  158.                             reqCount: INTEGER;                 {requested number of bytes}
  159.                             actCount: INTEGER;                 {actual number of bytes}
  160.                             dataPtr: Ptr;                      {pointer to data buffer}
  161.                             eom: Byte;                         {indicates logical end of message}
  162.                             flush: Byte;                       {send data now}
  163.                     );
  164.                     dspAttention: (
  165.                             attnCode: INTEGER;             {client attention code}
  166.                             attnSize: INTEGER;             {size of attention data}
  167.                             attnData: Ptr;                 {pointer to attention data}
  168.                             attnInterval: Byte;            {retransmit timer in 10-tick intervals}
  169.                             filler4: Byte;                 {filler for proper byte alignment}
  170.                     );
  171.                     dspOptions: (
  172.                             sendBlocking: INTEGER;     {quantum for data packets}
  173.                             sendTimer: Byte;           {send timer in 10-tick intervals}
  174.                             rtmtTimer: Byte;           {retransmit timer in 10-tick intervals}
  175.                             badSeqMax: Byte;           {threshold for sending retransmit advice}
  176.                             useCheckSum: Byte;         {use ddp packet checksum}
  177.                     );
  178.                     dspNewCID: (
  179.                             newCID: INTEGER;       {new connection id returned}
  180.                     );
  181.             end;
  182.  
  183.  
  184.  
  185.     { UsingADSP }
  186.  
  187.  
  188. implementation
  189. end.
  190.  
  191.